Among existing data center and existing storage products, high-speed non-volatile caching devices such as flash drives are widely used to increase access speeds of background shared storage. Cache write manners may include two: write-through and write-back.
Write-through means that, when data is written into a caching device, one copy of the data is also written into a shared storage device. An advantage of write-through is ease of operation, and data in the caching device is consistent with that in the shared storage device, so that data is not easily lost. A disadvantage of write-through is that a data access speed is relatively low, an overall read/write speed is greatly affected by the shared storage device, and it is relatively difficult to increase input/output operations per second (IOPS) of a system.
Write-back is as follows. Data is not synchronously written into a shared storage device when written into a caching device, and after the data is written into the caching device, a write success message may be returned to an upper-layer service, and the data is written into the shared storage device at an appropriate time by means of background management. An advantage of write-back is a high read/write speed, that is, high IOPS. A disadvantage of write-back is that operation management is complex and data inconsistency easily occurs when the caching device is faulty.
Because IOPS of a product is an important measure parameter for data center and storage products, write-back caching devices are widely used in various storage products. To overcome the problem that data inconsistency easily occurs in the write-back caching device, a mechanism that ensures data consistency needs to be added into the write-back caching device.
A manner in which two nodes are mutually mirrored is used in the prior art. Write-back cached content of one write-back caching device is mirrored to the other node. The manner is mainly as follows. When a write-back caching device receives a write service, the write-back caching device copies the request to a corresponding mirror write-back caching device, and the write operation is simultaneously performed on the mirror write-back caching device, so as to ensure data consistency between the two mutually mirrored write-back caching devices. Therefore, when one write-back caching device is faulty, data may be recovered and obtained from the corresponding mirror write-back caching device, so as to ensure data consistency.
It can be learned from the foregoing that the manner in which two write-back caching devices are mutually mirrored can solve consistency of two duplicates of write-back cache to some extent. However, in this manner, only two write-back caching devices are mutually mirrored, and a reliability requirement of a large-scale cluster cannot be met.